package javacode.chapter07.homework;

public class Homework04 {
    public static void main(String[] args) {
        int[] arr = {1, 3, 4, 6, 9};
        A03 a03 = new A03();
        for (int i : a03.copyArr(arr)) {
            System.out.println(i);
        }

    }
}


/**
 * 编写类A03，实现数组的赋值功能，输入旧数组，返回一个新数组，元素和旧数组一样
 */
class A03{
    int[] copyArr(int[] oldArr){
        int[] newArr = new int[oldArr.length];
        for (int i = 0; i < oldArr.length; i++) {
            newArr[i] = oldArr[i];
        }
        return newArr;
    }

}
